﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BlindData
{
	public static class LessThanGenerator
	{
		#region int

		/// <summary>
		/// Returns a random int less than the specified maximum.
		/// </summary>
		/// <param name="maxValue">The exclusive upper bound of the random int returned.</param>
		/// <returns></returns>
		public static int LessThan(this INext<int> next, int maxValue)
		{
			if (next == null)
			{
				throw new ArgumentNullException("next");
			}
			return next.Between(int.MinValue, maxValue);
		}

		/// <summary>
		/// Returns a nonnegative random int less than the specified maximum.
		/// </summary>
		/// <param name="maxValue">The exclusive upper bound of the random int returned.</param>
		/// <returns></returns>
		public static int LessThanPositive(this INext<int> next, int maxValue)
		{
			if (next == null)
			{
				throw new ArgumentNullException("next");
			}
			return next.Between(0, maxValue);
		}

		#endregion

		#region long

		/// <summary>
		/// Returns a random long less than the specified maximum.
		/// </summary>
		/// <param name="maxValue">The exclusive upper bound of the random long returned.</param>
		/// <returns></returns>
		public static long LessThan(this INext<long> next, long maxValue)
		{
			if (next == null)
			{
				throw new ArgumentNullException("next");
			}
			return next.Between(long.MinValue, maxValue);
		}

		/// <summary>
		/// Returns a nonnegative random long less than the specified maximum.
		/// </summary>
		/// <param name="maxValue">The exclusive upper bound of the random long returned.</param>
		/// <returns></returns>
		public static long LessThanPositive(this INext<long> next, long maxValue)
		{
			if (next == null)
			{
				throw new ArgumentNullException("next");
			}
			return next.Between(0, maxValue);
		}

		#endregion

		#region double

		/// <summary>
		/// Returns a random double less than the specified maximum.
		/// </summary>
		/// <param name="maxValue">The exclusive upper bound of the random double returned.</param>
		/// <returns></returns>
		public static double LessThan(this INext<double> next, double maxValue)
		{
			if (next == null)
			{
				throw new ArgumentNullException("next");
			}
			return next.Between(double.MinValue, maxValue);
		}

		/// <summary>
		/// Returns a nonnegative random double less than the specified maximum.
		/// </summary>
		/// <param name="maxValue">The exclusive upper bound of the random double returned.</param>
		/// <returns></returns>
		public static double LessThanPositive(this INext<double> next, double maxValue)
		{
			if (next == null)
			{
				throw new ArgumentNullException("next");
			}
			return next.Between(0, maxValue);
		}

		#endregion

		#region float

		/// <summary>
		/// Returns a random float less than the specified maximum.
		/// </summary>
		/// <param name="maxValue">The exclusive upper bound of the random float returned.</param>
		/// <returns></returns>
		public static float LessThan(this INext<float> next, float maxValue)
		{
			if (next == null)
			{
				throw new ArgumentNullException("next");
			}
			return next.Between(float.MinValue, maxValue);
		}

		/// <summary>
		/// Returns a nonnegative random float less than the specified maximum.
		/// </summary>
		/// <param name="maxValue">The exclusive upper bound of the random float returned.</param>
		/// <returns></returns>
		public static float LessThanPositive(this INext<float> next, float maxValue)
		{
			if (next == null)
			{
				throw new ArgumentNullException("next");
			}
			return next.Between(0, maxValue);
		}

		#endregion

		#region decimal

		/// <summary>
		/// Returns a random decimal less than the specified maximum.
		/// </summary>
		/// <param name="maxValue">The exclusive upper bound of the random decimal returned.</param>
		/// <returns></returns>
		public static decimal LessThan(this INext<decimal> next, decimal maxValue)
		{
			if (next == null)
			{
				throw new ArgumentNullException("next");
			}
			return next.Between(decimal.MinValue, maxValue);
		}

		/// <summary>
		/// Returns a nonnegative random decimal less than the specified maximum.
		/// </summary>
		/// <param name="maxValue">The exclusive upper bound of the random decimal returned.</param>
		/// <returns></returns>
		public static decimal LessThanPositive(this INext<decimal> next, decimal maxValue)
		{
			if (next == null)
			{
				throw new ArgumentNullException("next");
			}
			return next.Between(0, maxValue);
		}

		#endregion

		#region DateTime

		/// <summary>
		/// Returns a random DateTime less than the specified maximum.
		/// </summary>
		/// <param name="maxValue">The exclusive upper bound of the random DateTime returned.</param>
		/// <returns></returns>
		public static DateTime LessThan(this INext<DateTime> next, DateTime maxValue)
		{
			if (next == null)
			{
				throw new ArgumentNullException("next");
			}
			return next.Between(DateTime.MinValue, maxValue);
		}

		/// <summary>
		/// Returns a random DateTime less than the specified maximum.
		/// </summary>
		/// <param name="maxAge">The upper bound of the random DateTime returned.</param>
		/// <returns></returns>
		public static DateTime LessThanAge(this INext<DateTime> next, int maxAge)
		{
			if (next == null)
			{
				throw new ArgumentNullException("next");
			}
			return next.BetweenAge(0, maxAge);
		}

		#endregion
	}
}
